
//
//  XJGoodsEvaluateCell.m
//  XinJiangMall
//
//  Created by RaoBo on 2018/7/10.
//  Copyright © 2018年 Tzyang. All rights reserved.
//

#import "XJGoodsAllEvaluateCell.h"

@interface XJGoodsAllEvaluateCell()
@property (weak, nonatomic) IBOutlet UIImageView *iconIv; //头像
@property (weak, nonatomic) IBOutlet UILabel *nameLb; //昵称
@property (weak, nonatomic) IBOutlet UILabel *contentLb; //评论内容

@property (weak, nonatomic) IBOutlet UILabel *timeLb; // 评论时间

@property (weak, nonatomic) IBOutlet UIImageView *bigImgIV; //大图

@end

@implementation XJGoodsAllEvaluateCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)setEvaluateModel:(XJGoodsEvaluateModel *)evaluateModel {
    
    UIImage * default_headImg = [UIImage imageNamed:@"default_head"];
    UIImage * default_goodsImg = [UIImage imageNamed:@"default_goods"];

    [self.iconIv sd_setImageWithURL:[NSURL URLWithString:evaluateModel.customer_avatar] placeholderImage:default_headImg];
    
    self.nameLb.text = evaluateModel.customer_name;
    
    NSString *timeStamp = [NSString stringWithFormat:@"%@",evaluateModel.create_time];
    NSString *timeStr = [NSString timeStrFromTimeStamp:timeStamp];
    self.timeLb.text = timeStr;
    
    self.contentLb.text = evaluateModel.content;
    
    
    //如果没有图片就不显示 bigImgIV 这个页面 同时要要修改model的height 属性 
    if ([NSString isEmptyString:evaluateModel.images]) {
        evaluateModel.height = 100;
        self.bigImgIV.hidden = YES;
    }else {
        evaluateModel.height = 200;
        self.bigImgIV.hidden = NO;
        [self.bigImgIV sd_setImageWithURL:[NSURL URLWithString:evaluateModel.images] placeholderImage:default_goodsImg];
    }
    
    _evaluateModel = evaluateModel;
}
@end
